package com.group3.controller.teacherController;

import com.group3.service.TeacherService;
import com.group3.utils.Result;
import com.group3.pojo.UpdatePassword;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * TeacherController
 *
 * @author HY,PX
 * 2021/06/05 9:42
 **/

@Api(tags = "教师接口")
@RestController("/teacher")
public class TeacherController {
    @Resource
    TeacherService teacherService;


//    //    教师登陆接口
//    @ApiOperation("教师登陆接口")
//    @PostMapping("/login")
//    public Result login(@RequestBody Login login){
//
//        Result result = null;
//
//        return result;
//    }

    //    教师修改密码接口
    @ApiOperation("教师修改密码接口")
    @PutMapping(value = "/password",consumes = "application/json")
    public Result updatePas(@RequestBody UpdatePassword updatePassword,
                            HttpServletRequest request){
        String token = request.getHeader("token");//获取token
//todo:待测试
        Result result = teacherService.putPassword(updatePassword,token);

        return result;
    }
}
